package com.zsck.zsgy.ui.main.fragment

import android.os.Bundle
import com.blankj.utilcode.util.ResourceUtils
import com.google.android.material.tabs.TabLayout
import com.zsck.commonbase.widget.TabLayoutMediator
import com.zsck.zsgy.R
import com.zsck.zsgy.base.BaseFragment
import com.zsck.zsgy.databinding.FragmentSimpleCircleLayoutBinding
import com.zsck.zsgy.ui.main.fragment.simplecircle.SimpleCircleViewModel
import com.zsck.zsgy.ui.main.fragment.simplecircle.adapter.SimpleVPAdapter
import com.zsck.zsgy.util.Constants

class SimpleCircleFragment :
    BaseFragment<SimpleCircleViewModel, FragmentSimpleCircleLayoutBinding>() {

    companion object {
        fun newInstance() = SimpleCircleFragment()
    }

    override fun layoutId(): Int {
        return R.layout.fragment_simple_circle_layout
    }

    override fun initView(savedInstanceState: Bundle?) {

        var simpleVPAdapter = SimpleVPAdapter(this)
        var tabBar = binding.tabLayout
        binding.vpSimple.isUserInputEnabled = false//true:滑动，false：禁止滑动
        binding.vpSimple.adapter = simpleVPAdapter
        var tabLayoutMediator: TabLayoutMediator =
            TabLayoutMediator(tabBar!!, binding.vpSimple, object :
                TabLayoutMediator.OnConfigureTabCallback {
                override fun onConfigureTab(tab: TabLayout.Tab, position: Int) {
                    tab.text = Constants.simpleCircleTab!![position]

                }
            })
        tabLayoutMediator.attach()

    }


}